/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Riset1;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Presario
 */
@Entity
@Table(name = "DOCUMENT", catalog = "", schema = "db_amd_lsa")
@NamedQueries({@NamedQuery(name = "Document.findAll", query = "SELECT d FROM Document d"), @NamedQuery(name = "Document.findByIdDoc", query = "SELECT d FROM Document d WHERE d.idDoc = :idDoc"), @NamedQuery(name = "Document.findByTitle", query = "SELECT d FROM Document d WHERE d.title = :title"), @NamedQuery(name = "Document.findByAbstract1", query = "SELECT d FROM Document d WHERE d.abstract1 = :abstract1"), @NamedQuery(name = "Document.findByLocation", query = "SELECT d FROM Document d WHERE d.location = :location")})
public class Document implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_DOC")
    private String idDoc;
    @Column(name = "TITLE")
    private String title;
    @Column(name = "ABSTRACT")
    private String abstract1;
    @Column(name = "LOCATION")
    private String location;

    public Document() {
    }

    public Document(String idDoc) {
        this.idDoc = idDoc;
    }

    public String getIdDoc() {
        return idDoc;
    }

    public void setIdDoc(String idDoc) {
        String oldIdDoc = this.idDoc;
        this.idDoc = idDoc;
        changeSupport.firePropertyChange("idDoc", oldIdDoc, idDoc);
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        String oldTitle = this.title;
        this.title = title;
        changeSupport.firePropertyChange("title", oldTitle, title);
    }

    public String getAbstract1() {
        return abstract1;
    }

    public void setAbstract1(String abstract1) {
        String oldAbstract1 = this.abstract1;
        this.abstract1 = abstract1;
        changeSupport.firePropertyChange("abstract1", oldAbstract1, abstract1);
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        String oldLocation = this.location;
        this.location = location;
        changeSupport.firePropertyChange("location", oldLocation, location);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDoc != null ? idDoc.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Document)) {
            return false;
        }
        Document other = (Document) object;
        if ((this.idDoc == null && other.idDoc != null) || (this.idDoc != null && !this.idDoc.equals(other.idDoc))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Riset.Document[idDoc=" + idDoc + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
